import java.lang.*;

public class Complex {
    private double RealPart;
    private double ImagePart;
    //getter & setter

    public double getImagePart() {
        return ImagePart;
    }
    public void setImagePart(double imagePart) {
        ImagePart = imagePart;
    }
    public double getRealPart() {
        return RealPart;
    }
    public void setRealPart(double realPart) {
        RealPart = realPart;
    }
    //complex()

    public Complex(double R,double I){
        RealPart = R;
        ImagePart = I;
    }
    public boolean equals(Complex op2){
        if(this.getRealPart()==op2.getRealPart()&&this.getImagePart()==op2.getImagePart())
             return true;
        else 
             return false;
    }
    public String toString(){
        return RealPart + " + " + ImagePart + "i";
    }
    public Complex ComplexAdd(Complex op2){
        return new Complex(RealPart+op2.getRealPart(),ImagePart+op2.getImagePart());
    }
    public Complex ComplexSub(Complex op2){
        return new Complex(RealPart-op2.getRealPart(),ImagePart-op2.getImagePart());
    }
    public Complex ComplexMulti(Complex op2){
        return new Complex(RealPart*op2.getRealPart()-ImagePart*op2.getImagePart(),RealPart*op2.getImagePart()+ImagePart*op2.getRealPart());
    }
    public Complex ComplexDiv(Complex op2){
        double a=RealPart,b=ImagePart,c=op2.getRealPart(),d=op2.getImagePart();
        return new Complex((a*c+b*d)/(c*c+d*d),(b*c-a*d)/(c*c+d*d));
    }
}
